package com.spic.business.vehicle.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.spic.business.vehicle.mapper.VehicleManagementMapper;
import com.spic.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.spic.business.vehicle.mapper.VehicleManagementDirtyMapper;
import com.spic.business.vehicle.domain.VehicleManagementDirty;
import com.spic.business.vehicle.service.IVehicleManagementDirtyService;

/**
 * 车辆脏数据Service业务层处理
 * 
 * @author 赵祥
 * @date 2022-11-24
 */
@Service
public class VehicleManagementDirtyServiceImpl implements IVehicleManagementDirtyService 
{
    @Autowired
    private VehicleManagementDirtyMapper vehicleManagementDirtyMapper;
    @Autowired
    private VehicleManagementMapper vehicleManagementMapper;

    /**
     * 查询车辆脏数据
     * 
     * @param clientid 车辆脏数据主键
     * @return 车辆脏数据
     */
    @Override
    public VehicleManagementDirty selectVehicleManagementDirtyByClientid(Long clientid)
    {
        return vehicleManagementDirtyMapper.selectVehicleManagementDirtyByClientid(clientid);
    }

    /**
     * 查询车辆脏数据列表
     * 
     * @param vehicleManagementDirty 车辆脏数据
     * @return 车辆脏数据
     */
    @Override
    public List<VehicleManagementDirty> selectVehicleManagementDirtyList(VehicleManagementDirty vehicleManagementDirty)
    {
        return vehicleManagementDirtyMapper.selectVehicleManagementDirtyList(vehicleManagementDirty);
    }

    /**
     * 新增车辆脏数据
     * 
     * @param vehicleManagementDirty 车辆脏数据
     * @return 结果
     */
    @Override
    public int insertVehicleManagementDirty(VehicleManagementDirty vehicleManagementDirty)
    {
        return vehicleManagementDirtyMapper.insertVehicleManagementDirty(vehicleManagementDirty);
    }

    /**
     * 修改车辆脏数据
     * 
     * @param vehicleManagementDirty 车辆脏数据
     * @return 结果
     */
    @Override
    public int updateVehicleManagementDirty(VehicleManagementDirty vehicleManagementDirty)
    {
        return vehicleManagementDirtyMapper.updateVehicleManagementDirty(vehicleManagementDirty);
    }

    /**
     * 批量删除车辆脏数据
     * 
     * @param clientids 需要删除的车辆脏数据主键
     * @return 结果
     */
    @Override
    public int deleteVehicleManagementDirtyByClientids(Long[] clientids)
    {
        return vehicleManagementDirtyMapper.deleteVehicleManagementDirtyByClientids(clientids);
    }

    /**
     * 删除车辆脏数据信息
     * 
     * @param clientid 车辆脏数据主键
     * @return 结果
     */
    @Override
    public int deleteVehicleManagementDirtyByClientid(Long clientid)
    {
        return vehicleManagementDirtyMapper.deleteVehicleManagementDirtyByClientid(clientid);
    }

    @Override
    public Map<String, Integer> statistics() {
        Integer all = 0, allDirty = 0, incomplete = 0, incorrect = 0;
        all = vehicleManagementMapper.allCount();
        allDirty = vehicleManagementDirtyMapper.allDirtyCount();
        incomplete = vehicleManagementDirtyMapper.incompleteCount();
        incorrect = vehicleManagementDirtyMapper.incorrectCount();
        Map<String, Integer> map = new HashMap<>();
        map.put("all", all);
        map.put("allDirty", allDirty);
        map.put("incomplete", incomplete);
        map.put("incorrect", incorrect);
        return map;
    }
}
